package com.huika.dealontop.control.nearby.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.huika.dealontop.R;
import com.huika.dealontop.control.base.BaseAda;
import com.huika.dealontop.support.domain.NearbyLocalItemBean;
import com.huika.dealontop.support.domain.NearbyLocalItemChildBean;

/**
 * 分类排序节点适配器
 */
public class NearbyAllLocalAdapter extends BaseAda<NearbyLocalItemChildBean> {

    public NearbyAllLocalAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder vh = null;
        if (view == null) {
            view = mInflater.inflate(R.layout.item_list_home_selete_right, viewGroup, false);
            vh = new ViewHolder(view);
            view.setTag(vh);
        } else {
            vh = (ViewHolder) view.getTag();
        }
        NearbyLocalItemChildBean nearbyAllLocalbean = getItem(i);
        vh.tv_name.setText(nearbyAllLocalbean.text);
        vh.tv_name.setBackgroundResource(R.drawable.common_hover);
        //显示有子分类数据图标
        if (nearbyAllLocalbean.isSelete) {
            //子分类有被选中
            vh.tv_name.setTextColor(mContext.getResources().getColor(R.color.color_word_yellow));
        } else {
            vh.tv_name.setTextColor(mContext.getResources().getColor(R.color.color_333333));
        }
        return view;
    }

    class ViewHolder {
        public TextView tv_name;

        public ViewHolder(View view) {
            tv_name = (TextView) view.findViewById(R.id.name);
        }
    }
}
